bitkeeper revision 1.1159.1.458 (41a64b70b30rc4PElJkf-HBn1RT5xQ)
authorcl349@arcadians.cl.cam.ac.uk <cl349@arcadians.cl.cam.ac.uk>
Thu, 25 Nov 2004 21:15:28 +0000 (21:15 +0000)
committercl349@arcadians.cl.cam.ac.uk <cl349@arcadians.cl.cam.ac.uk>
Thu, 25 Nov 2004 21:15:28 +0000 (21:15 +0000)
sync w/ head.

1  2 
xen/arch/x86/memory.c
xen/arch/x86/traps.c
xen/common/dom_mem_ops.c
xen/include/xen/sched.h

index f5eac75ffe528a86db71288702e7dbbabc151a66,c46b5ed21064f8fc6a572c8e3f6a9d47de0bc650..70bcef8445d09f64b97f31af0ae3f74284b92b5a
@@@ -1309,17 -1312,34 +1312,34 @@@ int do_mmu_update
      /*
       * If we are resuming after preemption, read how much work we have already
       * done. This allows us to set the @done output parameter correctly.
+      * We also reset FOREIGNDOM here.
       */
-     if ( unlikely(count & MMU_UPDATE_PREEMPTED) )
+     if ( unlikely(count&(MMU_UPDATE_PREEMPTED|MMU_UPDATE_PREEMPT_FDOM_MASK)) )
      {
+         if ( !(count & MMU_UPDATE_PREEMPTED) )
+         {
+             /* Count overflow into private FOREIGNDOM field. */
+             MEM_LOG("do_mmu_update count is too large");
+             rc = -EINVAL;
+             goto out;
+         }
          count &= ~MMU_UPDATE_PREEMPTED;
+         domid = count >> MMU_UPDATE_PREEMPT_FDOM_SHIFT;
+         count &= ~MMU_UPDATE_PREEMPT_FDOM_MASK;
          if ( unlikely(pdone != NULL) )
              (void)get_user(done, pdone);
+         if ( (domid != current->id) &&
+              !do_extended_command(0, MMUEXT_SET_FOREIGNDOM | (domid << 16)) )
+         {
+             rc = -EINVAL;
+             goto out;
+         }
      }
  
 -    if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) )
 +    if ( unlikely(!array_access_ok(VERIFY_READ, ureqs, count, sizeof(req))) ) {
-         UNLOCK_BIGLOCK(d);
-         return -EFAULT;
+     {
+         rc = -EFAULT;
+         goto out;
      }
  
      for ( i = 0; i < count; i++ )
Simple merge
index cb1734e998addab3b53616042ac8be441b657ac8,b5c49fbe0e63309532ec17447a7cffb4612bfac5..ef558a73543381c24efb360dd5e7d468fe714d65
   */
  #define START_EXTENT_SHIFT 4 /* op[:4] == start_extent */
  
- #define PREEMPT_CHECK(_op)                                  \
-     if ( hypercall_preempt_check() ) {                      \
-         hypercall_create_continuation(                      \
-             __HYPERVISOR_dom_mem_op, 5,                     \
-             (_op) | (i << START_EXTENT_SHIFT),              \
-             extent_list, nr_extents, extent_order,          \
-             (d == current->domain) ? DOMID_SELF : d->id);   \
-         return __HYPERVISOR_dom_mem_op;                     \
-     }
+ #define PREEMPT_CHECK(_op)                          \
+     if ( hypercall_preempt_check() )                \
+         return hypercall_create_continuation(       \
+             __HYPERVISOR_dom_mem_op, 5,             \
+             (_op) | (i << START_EXTENT_SHIFT),      \
+             extent_list, nr_extents, extent_order,  \
 -            (d == current) ? DOMID_SELF : d->id)
++            (d == current->domain) ? DOMID_SELF : d->id);
  
  static long
  alloc_dom_mem(struct domain *d, 
Simple merge